<script setup>
import {
  ChatDotSquare,
  StarFilled,
  Edit,
  Share,
} from "@element-plus/icons-vue";
import {
  ref,
  reactive,
  toRefs,
  getCurrentInstance,
  onMounted,
  watch,
} from "vue";

// 评论功能实现
const textarea = ref("");
let { proxy } = getCurrentInstance();
async function share() {
  console.log(1111);
  let pdata = new FormData();
  pdata.append("textarea", textarea.value);
  let res = await proxy.$axios.post("/share", pdata);
  window.location.reload();
}

let pobj = ref({});
let uobj=ref({})
let fobj=ref({})
onMounted(async () => {
  let res = await proxy.$axios("/pinlundata");
  let res2=await proxy.$axios("getuserinfo")
  let res3=await proxy.$axios("getpinlun")
  uobj.value=res2.data
  fobj.value=res3.data.info
  console.log(res2.data);
  pobj.value = res.data.info;
});
//点赞功能实现



async function zhuanfa() {
  
}
</script>

<template>
  <div class="common-layout">
    <div>
      <el-input
        v-model.lazy="textarea"
        :rows="4"
        type="textarea"
        placeholder="有什么想分享的"
      />
      <el-button type="success" :icon="Share" @click="share" class="fbtn">发表</el-button>
    </div>
    <el-container class="box" v-for="(el, index) in pobj" :key="index">
      <el-header class="header">
        <img :src="suburl1+uobj.touxiang" class="uimg"/>
        <span>{{ el.phone }}</span>
      </el-header>
      <el-main class="neirou">
        <p>{{ el.pinlun }}</p>
        <div>
          <img />
        </div>
      </el-main>
      <el-footer class="footer">
        <div class="zf" @click="zhuanfa">
          <img src="../views/img/zf2.png" />
          {{el.zhuanfa}}
        </div>
        <div class="pl" >
          <img src="../views/img/pl2.png" />
          {{el.guanzu}}
        </div>
        <div class="dz">
          <img src="../views/img/dz2.png" />
          {{el.count}}
        </div>
      </el-footer>
    </el-container>
  </div>
</template>

<style scoped lang="scss">
.common-layout {
  width: 600px;
  margin-top: 20px;
}
.fbtn{
  margin-left: 520px;
}
.box {
  border: 1px solid white;
  border-radius: 15px;
  margin-top: 20px;
  margin-bottom: 30px;
  background-color: #F9F9F9;
}
.header {
  width: 100%;
  height: 50px;
  display: flex;
  .uimg{
    width: 50px;
    height: 50px;
    border: 1px solid white;;
    border-radius: 50%;
  }
}
.neirou{
  border: 1px solid white;
  border-radius: 10px;
  background-color: rgb(255, 254, 251);
}
.header > span {
  position: relative;
  top: 20px;
  left: 10px;
}
.footer {
  display: flex;
  justify-content: space-around;
  padding: 20px;
  font-size: 14px;
  font-weight: 500;
  color: #808090;
  img{
    width: 20px;
    height: 20px;
  }
}

.demo-fit {
  width: 50px;
  height: 50px;
  margin-top: 5px;
  display: flex;
}
.demo-fit .block {
  flex: 1;
  display: flex;
  flex-direction: column;
  flex-grow: 0;
}

.demo-fit .title {
  font-size: 12px;
}
.el-header {
  --el-header-padding: 0 10px;
  --el-header-height: 60px;
}

span:hover{
  cursor: pointer;
}
.zf {
  width: 20px;
  height: 20px;
  display: flex;
  margin-left: 60px;
  background-size: cover;
}


.pl {
  width: 20px;
  height: 20px;
  display: flex;
  margin-left: 60px;
  background-size: cover;
}


.dz {
  width: 20px;
  height: 20px;
  display: flex;
  margin-right: 10px;
  margin-left: 60px;
  background-size: cover;
}
</style>